<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class welcome_model extends CI_Model
{
	function __construct() 
	{
		parent::__construct();
	}
	
	function get_all($num=20, $start=0)
	{
		$this->db->where('bl_active',1) ;
		$query = $this->db->get('welcome', $num, $start) ;
		return $query->result() ;
	}
	
	function count_all()
	{
		$this->db->where('bl_active',1) ;
		$query = $this->db->get('welcome') ;
		return $query->num_rows() ;
	}
	
	function get_id($id)
	{
		$this->db->where('id',$id) ;
		$this->db->where('bl_active',1) ;
		$query = $this->db->get('welcome', $num, $start) ;
		return $query->row() ;
	}
	
	function save($table, $req, $wh='', $value=0)
	{
		if(!empty($value))
		{
			$this->db->where($wh, $value) ;
			return $this->db->update($table, $req) ;
		}
		else
		{
			$this->db->insert($table, $req) ;
			return $this->db->insert_id() ;
		}
	}
	
	public function get_id($table, $id=0, $wh='' )
    {
        if(!empty($id)) $this->db->where($wh, $id) ;
		$this->db->where('bl_active',1) ;
		$query = $this->db->get($table) ;
		return $query->row() ;
    }
	
}
?>